package agh.rozproszony.model;

import java.io.Serializable;

public class User implements Serializable {

    public static final int TYPE_USER = 0;
    public static final int TYPE_ADMIN = 1;
    private int id;
    private String email;
    private String login;
    private String password;
    private int type;

    public User() {
    }

    public User(int id, String email, String login, String password, int type) {
        this.id = id;
        this.email = email;
        this.login = login;
        this.password = password;
        this.type = type;
    }

    /**
     * Pobiera Id uzytkownika
     *
     * @return
     */
    public int getId() {
        return id;
    }

    /**
     * Ustawia Id uzytkownika
     *
     * @param id
     */
    public void setId(int id) {
        this.id = id;
    }

    /**
     * Pobiera adres e-mail uzytkownika
     *
     * @return
     */
    public String getEmail() {
        return email;
    }

    /**
     * Ustawia adres e-mail uzytkownika
     *
     * @param email
     */
    public void setEmail(String email) {
        this.email = email;
    }

    /**
     * Pobiera login uzytkownika
     *
     * @return
     */
    public String getLogin() {
        return login;
    }

    /**
     * Ustawia login uzytkownika
     *
     * @param login
     */
    public void setLogin(String login) {
        this.login = login;
    }

    /**
     * Pobiera haslo uzytkwonika
     *
     * @return
     */
    public String getPassword() {
        return password;
    }

    /**
     * Ustawia haslo uzytkownika
     *
     * @param password
     */
    public void setPassword(String password) {
        this.password = password;
    }

    /**
     * Pobiera typ uzytkownika np. User.TYPE_ADMIN
     *
     * @return
     */
    public int getType() {
        return type;
    }

    /**
     * Ustawia typ uzytkownika np. User.TYPE_ADMIN
     *
     * @param type
     */
    public void setType(int type) {
        this.type = type;
    }

    @Override
    public boolean equals(Object obj) {
        if (!(obj instanceof User)) {
            return false;
        }
        return ((User) obj).getId() == getId();
    }

    @Override
    public int hashCode() {
        return getId();
    }
    
    
}
